﻿#include "mainwindow.h"

#include <QApplication>
#include <QTextCodec>

int main(int argc, char *argv[])
{
    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForLocale(codec);

    //控制图片缩放质量
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);


    //获取屏幕设置中的分辨率
    DEVMODE NewDevMode;
    EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &NewDevMode);
    qreal  cx = NewDevMode.dmPelsWidth;			//当前设置的屏幕宽度

    qreal scale = cx / 1920;			// 960 = 1920 / 2
    qputenv("QT_SCALE_FACTOR", QString::number(scale).toLatin1());

    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}
